package com.starlink.model.util;

import com.starlink.model.dtomapper.ShoppingCartOrderDetailsDtoMapper;
import com.starlink.model.domain.ShoppingCartOrderDetailsDO;
import com.starlink.model.vo.ShoppingCartOrderDetailsVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class ShoppingCartOrderDetailsConvert {

    public static List<ShoppingCartOrderDetailsVO> buildShoppingCartOrderDetailsVoList(List<ShoppingCartOrderDetailsDO> shoppingCartOrderDetailsDOList) {
        if (CollectionUtils.isEmpty(shoppingCartOrderDetailsDOList)) {
            return Lists.newArrayList();
        }
        List<ShoppingCartOrderDetailsVO> shoppingCartOrderDetailsVOList = new ArrayList<>();
        for (ShoppingCartOrderDetailsDO shoppingCartOrderDetailsDO : shoppingCartOrderDetailsDOList) {
            shoppingCartOrderDetailsVOList.add(ShoppingCartOrderDetailsDtoMapper.INSTANCE.do2VO(shoppingCartOrderDetailsDO));
        }

        return shoppingCartOrderDetailsVOList;
    }
}
